import { createRouter, createWebHistory } from 'vue-router'
import LoginView from '../views/LoginView.vue'
import IndexView from '../views/IndexView.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'index',
      component: IndexView
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView
    },
	{
		path:"/register", 
		name: "register", 
		component: ()=> import("../views/RegisterView.vue"),
	},
	{
		path:"/next", 
		name: "next", 
		component: ()=> import("../views/NextRegisterView.vue"),
		//props: route => ({ query: route.query, params: route.params }) ,
	},
	{
		path:"/third", 
		name: "third", 
		component: ()=> import("../views/SuccessView.vue"), 
		//props: route => ({ query: route.query, params: route.params }) ,
	},
    {
      name: 'find-pass',
      path: '/find/pwd' ,
      component: ()=> import("../views/FindPwd.vue")
    },
    {
      name: 'find-pwd-next',
      path: '/find/next' ,
      component: ()=> import("../views/FindPwdNext.vue")
    },
    {
      name: 'resource-detail',
      path: '/detail/:id' ,
      component: ()=> import("../views/ResourceDetailView.vue"),
	  props: true,
    },
	{
	  name: 'catalog',
	  path: '/catalog' ,
	  component: ()=> import("../views/CatalogView.vue")
	},
	{
	  name: 'personal',
	  path: '/personal' ,
	  component: ()=> import("../views/PersonalView.vue")
	},
	{
	  name: 'upload',
	  path: '/upload' ,
	  component: ()=> import("../views/UploadResourceView.vue")
	},
	{
	  name: 'collect',
	  path: '/collect' ,
	  component: ()=> import("../views/CollectResourceView.vue")
	},
	{
		path:"/modify", 
		name: "modify-pwd", 
		component: ()=> import("../views/ModifyPasswordView.vue")
	},
	{
		path:"/attention", 
		name: "attention", 
		component: ()=> import("../views/AttentionView.vue")
	},
	{
		path:"/more/:uid", 
		name: "more", 
		component: ()=> import("../views/MoreResourceView.vue"),
		props: true 
	},
	{
		path:"/message", 
		name: "message", 
		component: ()=> import("../views/MessageView.vue"),
		props: route => ({type:route.query.type}) 
	},
	{
		path:"/chat", 
		name: "chat", 
		component: ()=> import("../views/ChatView.vue"),
		props: true 
	},

	  {
		  path: "/order", 
		  name: "order", 
		  component: ()=> import("../views/OrderListView.vue")
	  }
  ]
})

export default router
